/**
 * 路由二次封装
 *
 **/
import {createRouter, createWebHashHistory} from 'vue-router'
import staticRoutes from '../router/router'
import {loading} from "../utils/loading";

// 进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'


const router = createRouter({
    history: createWebHashHistory(),
    routes: staticRoutes,
})

router.beforeEach((to, from, next) => {
    NProgress.configure({showSpinner: false})
    NProgress.start()
    loading.show()
    next()
})

// 路由加载后
router.afterEach(() => {
    loading.hide()
    NProgress.done()
})

export default router